<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Repetier-Firmware: src/ArduinoAVR/Repetier/HAL.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="repetier-logo-trans128.png"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Repetier-Firmware
   &#160;<span id="projectnumber">0.91</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('_h_a_l_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">src/ArduinoAVR/Repetier/HAL.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_h_a_l_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">    This file is part of Repetier-Firmware.</span>
<a name="l00003"></a>00003 <span class="comment"></span>
<a name="l00004"></a>00004 <span class="comment">    Repetier-Firmware is free software: you can redistribute it and/or modify</span>
<a name="l00005"></a>00005 <span class="comment">    it under the terms of the GNU General Public License as published by</span>
<a name="l00006"></a>00006 <span class="comment">    the Free Software Foundation, either version 3 of the License, or</span>
<a name="l00007"></a>00007 <span class="comment">    (at your option) any later version.</span>
<a name="l00008"></a>00008 <span class="comment"></span>
<a name="l00009"></a>00009 <span class="comment">    Repetier-Firmware is distributed in the hope that it will be useful,</span>
<a name="l00010"></a>00010 <span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00011"></a>00011 <span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00012"></a>00012 <span class="comment">    GNU General Public License for more details.</span>
<a name="l00013"></a>00013 <span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment">    You should have received a copy of the GNU General Public License</span>
<a name="l00015"></a>00015 <span class="comment">    along with Repetier-Firmware.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<a name="l00016"></a>00016 <span class="comment"></span>
<a name="l00017"></a>00017 <span class="comment">    This firmware is a nearly complete rewrite of the sprinter firmware</span>
<a name="l00018"></a>00018 <span class="comment">    by kliment (https://github.com/kliment/Sprinter)</span>
<a name="l00019"></a>00019 <span class="comment">    which based on Tonokip RepRap firmware rewrite based off of Hydra-mmm firmware.</span>
<a name="l00020"></a>00020 <span class="comment"></span>
<a name="l00021"></a>00021 <span class="comment">  Functions in this file are used to communicate using ascii or repetier protocol.</span>
<a name="l00022"></a>00022 <span class="comment">*/</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="preprocessor">#ifndef HAL_H</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#define HAL_H</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;avr/pgmspace.h&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;avr/io.h&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#if CPU_ARCH==ARCH_AVR</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#include &lt;avr/io.h&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#else</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor">#define PROGMEM</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span><span class="preprocessor">#define PGM_P const char *</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span><span class="preprocessor">#define PSTR(s) s</span>
<a name="l00041"></a>00041 <span class="preprocessor"></span><span class="preprocessor">#define pgm_read_byte_near(x) (*(char*)x)</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#define pgm_read_byte(x) (*(char*)x)</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span>
<a name="l00045"></a><a class="code" href="_h_a_l_8h.html#a5ed6babb09100c6ea686ac77dcc201f0">00045</a> <span class="preprocessor">#define PACK</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span>
<a name="l00047"></a><a class="code" href="_h_a_l_8h.html#ae68067bbb7e4e74e66a097cf20f69a96">00047</a> <span class="preprocessor">#define FSTRINGVALUE(var,value) const char var[] PROGMEM = value;</span>
<a name="l00048"></a><a class="code" href="_h_a_l_8h.html#a9647b2e4e353b8a4c966dc7078ef1e73">00048</a> <span class="preprocessor"></span><span class="preprocessor">#define FSTRINGVAR(var) static const char var[] PROGMEM;</span>
<a name="l00049"></a><a class="code" href="_h_a_l_8h.html#a6c7567c1812b6b6ca9067377476ddc4e">00049</a> <span class="preprocessor"></span><span class="preprocessor">#define FSTRINGPARAM(var) PGM_P var</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span>
<a name="l00051"></a>00051 <span class="preprocessor">#include &lt;avr/eeprom.h&gt;</span>
<a name="l00052"></a>00052 <span class="preprocessor">#include &lt;avr/wdt.h&gt;</span>
<a name="l00056"></a><a class="code" href="_h_a_l_8h.html#a806ea970ccbc3c57a4d4ad45dbbb4725">00056</a> <span class="preprocessor">#define TIMER0_PRESCALE 64</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span>
<a name="l00058"></a><a class="code" href="_h_a_l_8h.html#a2fc5c022ca08920b3cf6eba085e5798e">00058</a> <span class="preprocessor">#define ANALOG_PRESCALER _BV(ADPS0)|_BV(ADPS1)|_BV(ADPS2)</span>
<a name="l00059"></a>00059 <span class="preprocessor"></span>
<a name="l00060"></a>00060 <span class="preprocessor">#if MOTHERBOARD==8 || MOTHERBOARD==9 || CPU_ARCH!=ARCH_AVR</span>
<a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor">#define EXTERNALSERIAL</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00063"></a>00063 <span class="preprocessor"></span><span class="comment">//#define EXTERNALSERIAL  // Force using arduino serial</span>
<a name="l00064"></a>00064 <span class="preprocessor">#ifndef EXTERNALSERIAL</span>
<a name="l00065"></a><a class="code" href="_h_a_l_8h.html#a303b63294d669d2c5a269c92bdb700d5">00065</a> <span class="preprocessor"></span><span class="preprocessor">#define  HardwareSerial_h // Don&#39;t use standard serial console</span>
<a name="l00066"></a>00066 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span><span class="preprocessor">#include &lt;inttypes.h&gt;</span>
<a name="l00068"></a>00068 <span class="preprocessor">#include &quot;Print.h&quot;</span>
<a name="l00069"></a>00069 
<a name="l00070"></a>00070 <span class="preprocessor">#if defined(ARDUINO) &amp;&amp; ARDUINO &gt;= 100</span>
<a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor">#include &quot;Arduino.h&quot;</span>
<a name="l00072"></a>00072 <span class="preprocessor">#else</span>
<a name="l00073"></a>00073 <span class="preprocessor"></span><span class="preprocessor">#include &quot;WProgram.h&quot;</span>
<a name="l00074"></a><a class="code" href="_h_a_l_8h.html#a8632c40d5411175b1dd8044667d2e265">00074</a> <span class="preprocessor">#define COMPAT_PRE1</span>
<a name="l00075"></a>00075 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00076"></a>00076 <span class="preprocessor"></span><span class="preprocessor">#if CPU_ARCH==ARCH_AVR</span>
<a name="l00077"></a>00077 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="fastio_8h.html">fastio.h</a>&quot;</span>
<a name="l00078"></a>00078 <span class="preprocessor">#else</span>
<a name="l00079"></a>00079 <span class="preprocessor"></span><span class="preprocessor">#define READ(IO)  digitalRead(IO)</span>
<a name="l00080"></a>00080 <span class="preprocessor"></span><span class="preprocessor">#define WRITE(IO, v)  digitalWrite(IO, v)</span>
<a name="l00081"></a>00081 <span class="preprocessor"></span><span class="preprocessor">#define SET_INPUT(IO)  pinMode(IO, INPUT)</span>
<a name="l00082"></a>00082 <span class="preprocessor"></span><span class="preprocessor">#define SET_OUTPUT(IO)  pinMode(IO, OUTPUT)</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00084"></a>00084 <span class="preprocessor"></span>
<a name="l00085"></a><a class="code" href="_h_a_l_8h.html#a0f536b06f8e01ba1a6d1d60416b7e3f7">00085</a> <span class="preprocessor">#define BEGIN_INTERRUPT_PROTECTED {uint8_t sreg=SREG;__asm volatile( &quot;cli&quot; ::: &quot;memory&quot; );</span>
<a name="l00086"></a><a class="code" href="_h_a_l_8h.html#a1f77fa92e63e79db1d3b45fbefbd26d8">00086</a> <span class="preprocessor"></span><span class="preprocessor">#define END_INTERRUPT_PROTECTED SREG=sreg;}</span>
<a name="l00087"></a><a class="code" href="_h_a_l_8h.html#a4f7ca723afd6908e40906f955d39de5a">00087</a> <span class="preprocessor"></span><span class="preprocessor">#define ESCAPE_INTERRUPT_PROTECTED SREG=sreg;</span>
<a name="l00088"></a>00088 <span class="preprocessor"></span>
<a name="l00089"></a><a class="code" href="_h_a_l_8h.html#afe7387252655a7ee07b26cb83c5ed0be">00089</a> <span class="preprocessor">#define EEPROM_OFFSET               0</span>
<a name="l00090"></a><a class="code" href="_h_a_l_8h.html#a6252b6137f2c7128b048b21f86157df7">00090</a> <span class="preprocessor"></span><span class="preprocessor">#define SECONDS_TO_TICKS(s) (unsigned long)(s*(float)F_CPU)</span>
<a name="l00091"></a><a class="code" href="_h_a_l_8h.html#a539de0f4b3ccbe41a4c8af7bfc6a4aa2">00091</a> <span class="preprocessor"></span><span class="preprocessor">#define ANALOG_REDUCE_BITS 0</span>
<a name="l00092"></a><a class="code" href="_h_a_l_8h.html#a87a291b3b9207590f54f559d3bedd622">00092</a> <span class="preprocessor"></span><span class="preprocessor">#define ANALOG_REDUCE_FACTOR 1</span>
<a name="l00093"></a>00093 <span class="preprocessor"></span>
<a name="l00094"></a><a class="code" href="_h_a_l_8h.html#a44caf16d49cdf922186674a1421b558d">00094</a> <span class="preprocessor">#define MAX_RAM 32767</span>
<a name="l00095"></a>00095 <span class="preprocessor"></span>
<a name="l00096"></a><a class="code" href="_h_a_l_8h.html#aef8a3a7087d7b20787653fb31b72c96f">00096</a> <span class="preprocessor">#define bit_clear(x,y) x&amp;= ~(1&lt;&lt;y) //cbi(x,y)</span>
<a name="l00097"></a><a class="code" href="_h_a_l_8h.html#a22db3eec77988c276bf7ff6a7ee2e5b0">00097</a> <span class="preprocessor"></span><span class="preprocessor">#define bit_set(x,y)   x|= (1&lt;&lt;y)//sbi(x,y)</span>
<a name="l00098"></a>00098 <span class="preprocessor"></span>
<a name="l00100"></a><a class="code" href="_h_a_l_8h.html#ab5c0fbe837494c5f9130a5914854250d">00100</a> <span class="preprocessor">#define I2C_READ    1</span>
<a name="l00101"></a>00101 <span class="preprocessor"></span>
<a name="l00102"></a><a class="code" href="_h_a_l_8h.html#a9536bf85bced4f4e549a82fb18eb6140">00102</a> <span class="preprocessor">#define I2C_WRITE   0</span>
<a name="l00103"></a>00103 <span class="preprocessor"></span>
<a name="l00104"></a>00104 
<a name="l00105"></a><a class="code" href="_h_a_l_8h.html#a14a0666abcf3bb67c7ff400b4a450467">00105</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="_h_a_l_8h.html#a14a0666abcf3bb67c7ff400b4a450467">speed_t</a>;
<a name="l00106"></a><a class="code" href="_h_a_l_8h.html#a91c2da9328232ca544377f4be938288d">00106</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="_h_a_l_8h.html#a91c2da9328232ca544377f4be938288d">ticks_t</a>;
<a name="l00107"></a><a class="code" href="_h_a_l_8h.html#ab14fc3b0e7b9535ec25836108ce96a45">00107</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="_h_a_l_8h.html#ab14fc3b0e7b9535ec25836108ce96a45">millis_t</a>;
<a name="l00108"></a>00108 
<a name="l00109"></a><a class="code" href="_h_a_l_8h.html#ade10189dcb8536dc4c28a5b59d3035c5">00109</a> <span class="preprocessor">#define FAST_INTEGER_SQRT</span>
<a name="l00110"></a>00110 <span class="preprocessor"></span>
<a name="l00111"></a>00111 <span class="preprocessor">#ifndef EXTERNALSERIAL</span>
<a name="l00112"></a>00112 <span class="preprocessor"></span><span class="comment">// Implement serial communication for one stream only!</span>
<a name="l00113"></a>00113 <span class="comment">/*</span>
<a name="l00114"></a>00114 <span class="comment">  HardwareSerial.h - Hardware serial library for Wiring</span>
<a name="l00115"></a>00115 <span class="comment">  Copyright (c) 2006 Nicholas Zambetti.  All right reserved.</span>
<a name="l00116"></a>00116 <span class="comment"></span>
<a name="l00117"></a>00117 <span class="comment">  This library is free software; you can redistribute it and/or</span>
<a name="l00118"></a>00118 <span class="comment">  modify it under the terms of the GNU Lesser General Public</span>
<a name="l00119"></a>00119 <span class="comment">  License as published by the Free Software Foundation; either</span>
<a name="l00120"></a>00120 <span class="comment">  version 2.1 of the License, or (at your option) any later version.</span>
<a name="l00121"></a>00121 <span class="comment"></span>
<a name="l00122"></a>00122 <span class="comment">  This library is distributed in the hope that it will be useful,</span>
<a name="l00123"></a>00123 <span class="comment">  but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00124"></a>00124 <span class="comment">  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00125"></a>00125 <span class="comment">  Lesser General Public License for more details.</span>
<a name="l00126"></a>00126 <span class="comment"></span>
<a name="l00127"></a>00127 <span class="comment">  You should have received a copy of the GNU Lesser General Public</span>
<a name="l00128"></a>00128 <span class="comment">  License along with this library; if not, write to the Free Software</span>
<a name="l00129"></a>00129 <span class="comment">  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA</span>
<a name="l00130"></a>00130 <span class="comment"></span>
<a name="l00131"></a>00131 <span class="comment">  Modified 28 September 2010 by Mark Sproul</span>
<a name="l00132"></a>00132 <span class="comment"></span>
<a name="l00133"></a>00133 <span class="comment">  Modified to use only 1 queue with fixed length by Repetier</span>
<a name="l00134"></a>00134 <span class="comment">*/</span>
<a name="l00135"></a>00135 
<a name="l00136"></a><a class="code" href="_h_a_l_8h.html#aaa07390e6158db5d82d40510d2ae02d5">00136</a> <span class="preprocessor">#define SERIAL_BUFFER_SIZE 128</span>
<a name="l00137"></a><a class="code" href="_h_a_l_8h.html#a802cf662365d7027fced85e4bfb8b968">00137</a> <span class="preprocessor"></span><span class="preprocessor">#define SERIAL_BUFFER_MASK 127</span>
<a name="l00138"></a><a class="code" href="_h_a_l_8h.html#af0d9a9a9aac810bf58f698086f76e516">00138</a> <span class="preprocessor"></span><span class="preprocessor">#define SERIAL_TX_BUFFER_SIZE 64</span>
<a name="l00139"></a><a class="code" href="_h_a_l_8h.html#aa9e24a9121e507c4f7a0ed7a06c77763">00139</a> <span class="preprocessor"></span><span class="preprocessor">#define SERIAL_TX_BUFFER_MASK 63</span>
<a name="l00140"></a>00140 <span class="preprocessor"></span>
<a name="l00141"></a><a class="code" href="structring__buffer.html">00141</a> <span class="keyword">struct </span><a class="code" href="structring__buffer.html">ring_buffer</a>
<a name="l00142"></a>00142 {
<a name="l00143"></a><a class="code" href="structring__buffer.html#a2d9546fdd214976a34a12baa9c758ada">00143</a>     <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="structring__buffer.html#a2d9546fdd214976a34a12baa9c758ada">buffer</a>[<a class="code" href="_h_a_l_8h.html#aaa07390e6158db5d82d40510d2ae02d5">SERIAL_BUFFER_SIZE</a>];
<a name="l00144"></a><a class="code" href="structring__buffer.html#aae22e2b3b3f930af186a18d70c863648">00144</a>     <span class="keyword">volatile</span> uint8_t <a class="code" href="structring__buffer.html#aae22e2b3b3f930af186a18d70c863648">head</a>;
<a name="l00145"></a><a class="code" href="structring__buffer.html#a7d299975a87db769b08769ea6b6561eb">00145</a>     <span class="keyword">volatile</span> uint8_t <a class="code" href="structring__buffer.html#a7d299975a87db769b08769ea6b6561eb">tail</a>;
<a name="l00146"></a>00146 };
<a name="l00147"></a><a class="code" href="structring__buffer__tx.html">00147</a> <span class="keyword">struct </span><a class="code" href="structring__buffer__tx.html">ring_buffer_tx</a>
<a name="l00148"></a>00148 {
<a name="l00149"></a><a class="code" href="structring__buffer__tx.html#af7c06edd9920321555fccf62eec0229b">00149</a>     <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="structring__buffer__tx.html#af7c06edd9920321555fccf62eec0229b">buffer</a>[<a class="code" href="_h_a_l_8h.html#af0d9a9a9aac810bf58f698086f76e516">SERIAL_TX_BUFFER_SIZE</a>];
<a name="l00150"></a><a class="code" href="structring__buffer__tx.html#aae22e2b3b3f930af186a18d70c863648">00150</a>     <span class="keyword">volatile</span> uint8_t <a class="code" href="structring__buffer__tx.html#aae22e2b3b3f930af186a18d70c863648">head</a>;
<a name="l00151"></a><a class="code" href="structring__buffer__tx.html#a7d299975a87db769b08769ea6b6561eb">00151</a>     <span class="keyword">volatile</span> uint8_t <a class="code" href="structring__buffer__tx.html#a7d299975a87db769b08769ea6b6561eb">tail</a>;
<a name="l00152"></a>00152 };
<a name="l00153"></a>00153 
<a name="l00154"></a><a class="code" href="class_r_f_hardware_serial.html">00154</a> <span class="keyword">class </span><a class="code" href="class_r_f_hardware_serial.html">RFHardwareSerial</a> : <span class="keyword">public</span> Print
<a name="l00155"></a>00155 {
<a name="l00156"></a>00156 <span class="keyword">public</span>:
<a name="l00157"></a><a class="code" href="class_r_f_hardware_serial.html#a3ceb97590500d70e4f593a3a3505a06e">00157</a>     <a class="code" href="structring__buffer.html">ring_buffer</a> *<a class="code" href="class_r_f_hardware_serial.html#a3ceb97590500d70e4f593a3a3505a06e">_rx_buffer</a>;
<a name="l00158"></a><a class="code" href="class_r_f_hardware_serial.html#a255f8188fbd3b483165fb352dc647e81">00158</a>     <a class="code" href="structring__buffer__tx.html">ring_buffer_tx</a> *<a class="code" href="class_r_f_hardware_serial.html#a255f8188fbd3b483165fb352dc647e81">_tx_buffer</a>;
<a name="l00159"></a><a class="code" href="class_r_f_hardware_serial.html#a153b1679eb26fd221c6eab0b85ea6604">00159</a>     <span class="keyword">volatile</span> uint8_t *<a class="code" href="class_r_f_hardware_serial.html#a153b1679eb26fd221c6eab0b85ea6604">_ubrrh</a>;
<a name="l00160"></a><a class="code" href="class_r_f_hardware_serial.html#a7fc0285f716afc115aebd1751184eecf">00160</a>     <span class="keyword">volatile</span> uint8_t *<a class="code" href="class_r_f_hardware_serial.html#a7fc0285f716afc115aebd1751184eecf">_ubrrl</a>;
<a name="l00161"></a><a class="code" href="class_r_f_hardware_serial.html#a15e4698ed69c55c428ab0c201a2b4c0a">00161</a>     <span class="keyword">volatile</span> uint8_t *<a class="code" href="class_r_f_hardware_serial.html#a15e4698ed69c55c428ab0c201a2b4c0a">_ucsra</a>;
<a name="l00162"></a><a class="code" href="class_r_f_hardware_serial.html#ae954be19035e8fb2a80e58908aa5ef4b">00162</a>     <span class="keyword">volatile</span> uint8_t *<a class="code" href="class_r_f_hardware_serial.html#ae954be19035e8fb2a80e58908aa5ef4b">_ucsrb</a>;
<a name="l00163"></a><a class="code" href="class_r_f_hardware_serial.html#abddf2d2d6b5a05b004f42de06519577b">00163</a>     <span class="keyword">volatile</span> uint8_t *<a class="code" href="class_r_f_hardware_serial.html#abddf2d2d6b5a05b004f42de06519577b">_udr</a>;
<a name="l00164"></a><a class="code" href="class_r_f_hardware_serial.html#acbd333cef3f8ec3a8e2dca77b02b3511">00164</a>     uint8_t <a class="code" href="class_r_f_hardware_serial.html#acbd333cef3f8ec3a8e2dca77b02b3511">_rxen</a>;
<a name="l00165"></a><a class="code" href="class_r_f_hardware_serial.html#ad951d0a88a63fe2971d2cef44a407419">00165</a>     uint8_t <a class="code" href="class_r_f_hardware_serial.html#ad951d0a88a63fe2971d2cef44a407419">_txen</a>;
<a name="l00166"></a><a class="code" href="class_r_f_hardware_serial.html#a4eed30c69d0ce191c9fdc4828e07c7a1">00166</a>     uint8_t <a class="code" href="class_r_f_hardware_serial.html#a4eed30c69d0ce191c9fdc4828e07c7a1">_rxcie</a>;
<a name="l00167"></a><a class="code" href="class_r_f_hardware_serial.html#a07b4b2f8df43eb85fb4c132ff7ccfb46">00167</a>     uint8_t <a class="code" href="class_r_f_hardware_serial.html#a07b4b2f8df43eb85fb4c132ff7ccfb46">_udrie</a>;
<a name="l00168"></a><a class="code" href="class_r_f_hardware_serial.html#aaa016ee9deb727df7e20eecea191e3af">00168</a>     uint8_t <a class="code" href="class_r_f_hardware_serial.html#aaa016ee9deb727df7e20eecea191e3af">_u2x</a>;
<a name="l00169"></a>00169 <span class="keyword">public</span>:
<a name="l00170"></a>00170     <a class="code" href="class_r_f_hardware_serial.html#a60645c2c2014ca35e565e147f4b7eb3a">RFHardwareSerial</a>(<a class="code" href="structring__buffer.html">ring_buffer</a> *<a class="code" href="_h_a_l_8cpp.html#ace077a9982cfc6e7cffcc11101b0df4c">rx_buffer</a>, <a class="code" href="structring__buffer__tx.html">ring_buffer_tx</a> *<a class="code" href="_h_a_l_8cpp.html#a913c237b12b90ca109743c3ac15725d2">tx_buffer</a>,
<a name="l00171"></a>00171                      <span class="keyword">volatile</span> uint8_t *ubrrh, <span class="keyword">volatile</span> uint8_t *ubrrl,
<a name="l00172"></a>00172                      <span class="keyword">volatile</span> uint8_t *ucsra, <span class="keyword">volatile</span> uint8_t *ucsrb,
<a name="l00173"></a>00173                      <span class="keyword">volatile</span> uint8_t *udr,
<a name="l00174"></a>00174                      uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udrie, uint8_t u2x);
<a name="l00175"></a>00175     <span class="keywordtype">void</span> <a class="code" href="class_r_f_hardware_serial.html#ad3fcb1f90c11e7939fcf5079e2d29b89">begin</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>);
<a name="l00176"></a>00176     <span class="keywordtype">void</span> <a class="code" href="class_r_f_hardware_serial.html#aaf81d3fdaf258088d7692fa70cece087">end</a>();
<a name="l00177"></a>00177     <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="class_r_f_hardware_serial.html#aeec8f4dbef97221a6041d6cdc6e9b716">available</a>(<span class="keywordtype">void</span>);
<a name="l00178"></a>00178     <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="class_r_f_hardware_serial.html#a65e3a688fcd31f2f486d3af02c400d8f">peek</a>(<span class="keywordtype">void</span>);
<a name="l00179"></a>00179     <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="class_r_f_hardware_serial.html#aead319e2866cf90d56c10f2ed39a4396">read</a>(<span class="keywordtype">void</span>);
<a name="l00180"></a>00180     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_r_f_hardware_serial.html#a0a4efd3d0f68d057f23eb5dfcd16c17c">flush</a>(<span class="keywordtype">void</span>);
<a name="l00181"></a>00181 <span class="preprocessor">#ifdef COMPAT_PRE1</span>
<a name="l00182"></a>00182 <span class="preprocessor"></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_r_f_hardware_serial.html#a729ed73e880aa6992f5c38ca84aa99b1">write</a>(uint8_t);
<a name="l00183"></a>00183 <span class="preprocessor">#else</span>
<a name="l00184"></a>00184 <span class="preprocessor"></span>    <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> <a class="code" href="class_r_f_hardware_serial.html#a729ed73e880aa6992f5c38ca84aa99b1">write</a>(uint8_t);
<a name="l00185"></a>00185 <span class="preprocessor">#endif</span>
<a name="l00186"></a>00186 <span class="preprocessor"></span>    <span class="keyword">using</span> <a class="code" href="class_r_f_hardware_serial.html#a729ed73e880aa6992f5c38ca84aa99b1">Print::write</a>; <span class="comment">// pull in write(str) and write(buf, size) from Print</span>
<a name="l00187"></a>00187     <a class="code" href="class_r_f_hardware_serial.html#a9b3baad8c612d81b96e46f84d7e97580">operator bool</a>();
<a name="l00188"></a>00188     <span class="keywordtype">int</span> <a class="code" href="class_r_f_hardware_serial.html#a0eb9f6296a682a7601fd607325ad38b6">outputUnused</a>(<span class="keywordtype">void</span>); <span class="comment">// Used for output in interrupts</span>
<a name="l00189"></a>00189 };
<a name="l00190"></a>00190 <span class="keyword">extern</span> <a class="code" href="class_r_f_hardware_serial.html">RFHardwareSerial</a> <a class="code" href="_h_a_l_8h.html#afbb1290b3ca9b145cd2f83d39cccf570">RFSerial</a>;
<a name="l00191"></a><a class="code" href="_h_a_l_8h.html#a17da3e86d60c2b299dd9e523bf746699">00191</a> <span class="preprocessor">#define RFSERIAL RFSerial</span>
<a name="l00192"></a>00192 <span class="preprocessor"></span><span class="comment">//extern ring_buffer tx_buffer;</span>
<a name="l00193"></a><a class="code" href="_h_a_l_8h.html#a2460646a2c88b65c0f8d1b9ba7c8d0f5">00193</a> <span class="preprocessor">#define WAIT_OUT_EMPTY while(tx_buffer.head != tx_buffer.tail) {}</span>
<a name="l00194"></a>00194 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00195"></a>00195 <span class="preprocessor"></span><span class="preprocessor">#define RFSERIAL Serial</span>
<a name="l00196"></a>00196 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00197"></a>00197 <span class="preprocessor"></span>
<a name="l00198"></a><a class="code" href="_h_a_l_8h.html#a4e146bcc38d06e2a9aa55ccbf21b600a">00198</a> <span class="preprocessor">#define OUT_P_I(p,i) Com::printF(PSTR(p),(int)(i))</span>
<a name="l00199"></a><a class="code" href="_h_a_l_8h.html#a626b60bc02c5e4a9aa90d7851ec4d4c7">00199</a> <span class="preprocessor"></span><span class="preprocessor">#define OUT_P_I_LN(p,i) Com::printFLN(PSTR(p),(int)(i))</span>
<a name="l00200"></a><a class="code" href="_h_a_l_8h.html#ae9a1d8c5c5118dcf862af2dc40a8b23a">00200</a> <span class="preprocessor"></span><span class="preprocessor">#define OUT_P_L(p,i) Com::printF(PSTR(p),(long)(i))</span>
<a name="l00201"></a><a class="code" href="_h_a_l_8h.html#aa78c8b9cd9c351fdaad74486b21c3af0">00201</a> <span class="preprocessor"></span><span class="preprocessor">#define OUT_P_L_LN(p,i) Com::printFLN(PSTR(p),(long)(i))</span>
<a name="l00202"></a><a class="code" href="_h_a_l_8h.html#a16983fb51961d90a6b6c4f24b1041885">00202</a> <span class="preprocessor"></span><span class="preprocessor">#define OUT_P_F(p,i) Com::printF(PSTR(p),(float)(i))</span>
<a name="l00203"></a><a class="code" href="_h_a_l_8h.html#ab8f60a8ebbabb650f7eee866e88e8ef7">00203</a> <span class="preprocessor"></span><span class="preprocessor">#define OUT_P_F_LN(p,i) Com::printFLN(PSTR(p),(float)(i))</span>
<a name="l00204"></a><a class="code" href="_h_a_l_8h.html#a6ca8478da16088491c73594090191c40">00204</a> <span class="preprocessor"></span><span class="preprocessor">#define OUT_P_FX(p,i,x) Com::printF(PSTR(p),(float)(i),x)</span>
<a name="l00205"></a><a class="code" href="_h_a_l_8h.html#ab0a7b7474ee8525af4aa296f98945268">00205</a> <span class="preprocessor"></span><span class="preprocessor">#define OUT_P_FX_LN(p,i,x) Com::printFLN(PSTR(p),(float)(i),x)</span>
<a name="l00206"></a><a class="code" href="_h_a_l_8h.html#a6174c84155b88c81a35cdb184214d042">00206</a> <span class="preprocessor"></span><span class="preprocessor">#define OUT_P(p) Com::printF(PSTR(p))</span>
<a name="l00207"></a><a class="code" href="_h_a_l_8h.html#a026f71fdb25c58319213d95ec3d32e51">00207</a> <span class="preprocessor"></span><span class="preprocessor">#define OUT_P_LN(p) Com::printFLN(PSTR(p))</span>
<a name="l00208"></a><a class="code" href="_h_a_l_8h.html#ab3bec22e4d3c7c543f791e2c61923b33">00208</a> <span class="preprocessor"></span><span class="preprocessor">#define OUT_ERROR_P(p) Com::printErrorF(PSTR(p))</span>
<a name="l00209"></a><a class="code" href="_h_a_l_8h.html#a086a3926126156cd7f53aa5d05942cc3">00209</a> <span class="preprocessor"></span><span class="preprocessor">#define OUT_ERROR_P_LN(p) {Com::printErrorF(PSTR(p));Com::println();}</span>
<a name="l00210"></a><a class="code" href="_h_a_l_8h.html#a97e418f3a4ce0f3d316d54638eb39c61">00210</a> <span class="preprocessor"></span><span class="preprocessor">#define OUT(v) Com::print(v)</span>
<a name="l00211"></a><a class="code" href="_h_a_l_8h.html#ad921e3744830690bcc58bbc30c842cc9">00211</a> <span class="preprocessor"></span><span class="preprocessor">#define OUT_LN Com::println()</span>
<a name="l00212"></a>00212 <span class="preprocessor"></span>
<a name="l00213"></a><a class="code" href="class_h_a_l.html">00213</a> <span class="keyword">class </span><a class="code" href="class_h_a_l.html">HAL</a>
<a name="l00214"></a>00214 {
<a name="l00215"></a>00215 <span class="keyword">public</span>:
<a name="l00216"></a>00216     <a class="code" href="class_h_a_l.html#a4bec08ef577bbee11cd0b642d72eacf8">HAL</a>();
<a name="l00217"></a>00217     <span class="keyword">virtual</span> <a class="code" href="class_h_a_l.html#a4738f0d9cf2db27662262b839a09e132">~HAL</a>();
<a name="l00218"></a><a class="code" href="class_h_a_l.html#aaf7e5bdf9c09eb34ed8131e4ecaeef4e">00218</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#aaf7e5bdf9c09eb34ed8131e4ecaeef4e">hwSetup</a>(<span class="keywordtype">void</span>)
<a name="l00219"></a>00219     {}
<a name="l00220"></a>00220     <span class="comment">// return val&#39;val</span>
<a name="l00221"></a>00221     <span class="keyword">static</span> uint16_t <a class="code" href="class_h_a_l.html#a082b7fadae763dec05f510418ccdb61c">integerSqrt</a>(<span class="keywordtype">long</span> a);
<a name="l00229"></a><a class="code" href="class_h_a_l.html#a9984f0dc6a7bd5d81ee52b850cde8064">00229</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="class_h_a_l.html#a9984f0dc6a7bd5d81ee52b850cde8064" title="Optimized division.">Div4U2U</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> a,<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> b)
<a name="l00230"></a>00230     {
<a name="l00231"></a>00231 <span class="preprocessor">#if CPU_ARCH==ARCH_AVR</span>
<a name="l00232"></a>00232 <span class="preprocessor"></span>        <span class="comment">// r14/r15 remainder</span>
<a name="l00233"></a>00233         <span class="comment">// r16 counter</span>
<a name="l00234"></a>00234         __asm__ __volatile__ (
<a name="l00235"></a>00235             <span class="stringliteral">&quot;clr r14 \n\t&quot;</span>
<a name="l00236"></a>00236             <span class="stringliteral">&quot;sub r15,r15 \n\t&quot;</span>
<a name="l00237"></a>00237             <span class="stringliteral">&quot;tst %D0 \n\t&quot;</span>
<a name="l00238"></a>00238             <span class="stringliteral">&quot;brne do32%= \n\t&quot;</span>
<a name="l00239"></a>00239             <span class="stringliteral">&quot;tst %C0 \n\t&quot;</span>
<a name="l00240"></a>00240             <span class="stringliteral">&quot;breq donot24%= \n\t&quot;</span>
<a name="l00241"></a>00241             <span class="stringliteral">&quot;rjmp do24%= \n\t&quot;</span>
<a name="l00242"></a>00242             <span class="stringliteral">&quot;donot24%=:&quot;</span> <span class="stringliteral">&quot;ldi r16,17 \n\t&quot;</span> <span class="comment">// 16 Bit divide</span>
<a name="l00243"></a>00243             <span class="stringliteral">&quot;d16u_1%=:&quot;</span> <span class="stringliteral">&quot;rol %A0 \n\t&quot;</span>
<a name="l00244"></a>00244             <span class="stringliteral">&quot;rol %B0 \n\t&quot;</span>
<a name="l00245"></a>00245             <span class="stringliteral">&quot;dec r16 \n\t&quot;</span>
<a name="l00246"></a>00246             <span class="stringliteral">&quot;brne       d16u_2%= \n\t&quot;</span>
<a name="l00247"></a>00247             <span class="stringliteral">&quot;rjmp end%= \n\t&quot;</span>
<a name="l00248"></a>00248             <span class="stringliteral">&quot;d16u_2%=:&quot;</span> <span class="stringliteral">&quot;rol r14 \n\t&quot;</span>
<a name="l00249"></a>00249             <span class="stringliteral">&quot;rol r15 \n\t&quot;</span>
<a name="l00250"></a>00250             <span class="stringliteral">&quot;sub r14,%A2 \n\t&quot;</span>
<a name="l00251"></a>00251             <span class="stringliteral">&quot;sbc r15,%B2 \n\t&quot;</span>
<a name="l00252"></a>00252             <span class="stringliteral">&quot;brcc       d16u_3%= \n\t&quot;</span>
<a name="l00253"></a>00253             <span class="stringliteral">&quot;add r14,%A2 \n\t&quot;</span>
<a name="l00254"></a>00254             <span class="stringliteral">&quot;adc r15,%B2 \n\t&quot;</span>
<a name="l00255"></a>00255             <span class="stringliteral">&quot;clc \n\t&quot;</span>
<a name="l00256"></a>00256             <span class="stringliteral">&quot;rjmp d16u_1%= \n\t&quot;</span>
<a name="l00257"></a>00257             <span class="stringliteral">&quot;d16u_3%=:&quot;</span> <span class="stringliteral">&quot;sec \n\t&quot;</span>
<a name="l00258"></a>00258             <span class="stringliteral">&quot;rjmp d16u_1%= \n\t&quot;</span>
<a name="l00259"></a>00259             <span class="stringliteral">&quot;do32%=:&quot;</span> <span class="comment">// divide full 32 bit</span>
<a name="l00260"></a>00260             <span class="stringliteral">&quot;rjmp do32B%= \n\t&quot;</span>
<a name="l00261"></a>00261             <span class="stringliteral">&quot;do24%=:&quot;</span> <span class="comment">// divide 24 bit</span>
<a name="l00262"></a>00262 
<a name="l00263"></a>00263             <span class="stringliteral">&quot;ldi r16,25 \n\t&quot;</span> <span class="comment">// 24 Bit divide</span>
<a name="l00264"></a>00264             <span class="stringliteral">&quot;d24u_1%=:&quot;</span> <span class="stringliteral">&quot;rol %A0 \n\t&quot;</span>
<a name="l00265"></a>00265             <span class="stringliteral">&quot;rol %B0 \n\t&quot;</span>
<a name="l00266"></a>00266             <span class="stringliteral">&quot;rol %C0 \n\t&quot;</span>
<a name="l00267"></a>00267             <span class="stringliteral">&quot;dec r16 \n\t&quot;</span>
<a name="l00268"></a>00268             <span class="stringliteral">&quot;brne       d24u_2%= \n\t&quot;</span>
<a name="l00269"></a>00269             <span class="stringliteral">&quot;rjmp end%= \n\t&quot;</span>
<a name="l00270"></a>00270             <span class="stringliteral">&quot;d24u_2%=:&quot;</span> <span class="stringliteral">&quot;rol r14 \n\t&quot;</span>
<a name="l00271"></a>00271             <span class="stringliteral">&quot;rol r15 \n\t&quot;</span>
<a name="l00272"></a>00272             <span class="stringliteral">&quot;sub r14,%A2 \n\t&quot;</span>
<a name="l00273"></a>00273             <span class="stringliteral">&quot;sbc r15,%B2 \n\t&quot;</span>
<a name="l00274"></a>00274             <span class="stringliteral">&quot;brcc       d24u_3%= \n\t&quot;</span>
<a name="l00275"></a>00275             <span class="stringliteral">&quot;add r14,%A2 \n\t&quot;</span>
<a name="l00276"></a>00276             <span class="stringliteral">&quot;adc r15,%B2 \n\t&quot;</span>
<a name="l00277"></a>00277             <span class="stringliteral">&quot;clc \n\t&quot;</span>
<a name="l00278"></a>00278             <span class="stringliteral">&quot;rjmp d24u_1%= \n\t&quot;</span>
<a name="l00279"></a>00279             <span class="stringliteral">&quot;d24u_3%=:&quot;</span> <span class="stringliteral">&quot;sec \n\t&quot;</span>
<a name="l00280"></a>00280             <span class="stringliteral">&quot;rjmp d24u_1%= \n\t&quot;</span>
<a name="l00281"></a>00281 
<a name="l00282"></a>00282             <span class="stringliteral">&quot;do32B%=:&quot;</span> <span class="comment">// divide full 32 bit</span>
<a name="l00283"></a>00283 
<a name="l00284"></a>00284             <span class="stringliteral">&quot;ldi r16,33 \n\t&quot;</span> <span class="comment">// 32 Bit divide</span>
<a name="l00285"></a>00285             <span class="stringliteral">&quot;d32u_1%=:&quot;</span> <span class="stringliteral">&quot;rol %A0 \n\t&quot;</span>
<a name="l00286"></a>00286             <span class="stringliteral">&quot;rol %B0 \n\t&quot;</span>
<a name="l00287"></a>00287             <span class="stringliteral">&quot;rol %C0 \n\t&quot;</span>
<a name="l00288"></a>00288             <span class="stringliteral">&quot;rol %D0 \n\t&quot;</span>
<a name="l00289"></a>00289             <span class="stringliteral">&quot;dec r16 \n\t&quot;</span>
<a name="l00290"></a>00290             <span class="stringliteral">&quot;brne       d32u_2%= \n\t&quot;</span>
<a name="l00291"></a>00291             <span class="stringliteral">&quot;rjmp end%= \n\t&quot;</span>
<a name="l00292"></a>00292             <span class="stringliteral">&quot;d32u_2%=:&quot;</span> <span class="stringliteral">&quot;rol r14 \n\t&quot;</span>
<a name="l00293"></a>00293             <span class="stringliteral">&quot;rol r15 \n\t&quot;</span>
<a name="l00294"></a>00294             <span class="stringliteral">&quot;sub r14,%A2 \n\t&quot;</span>
<a name="l00295"></a>00295             <span class="stringliteral">&quot;sbc r15,%B2 \n\t&quot;</span>
<a name="l00296"></a>00296             <span class="stringliteral">&quot;brcc       d32u_3%= \n\t&quot;</span>
<a name="l00297"></a>00297             <span class="stringliteral">&quot;add r14,%A2 \n\t&quot;</span>
<a name="l00298"></a>00298             <span class="stringliteral">&quot;adc r15,%B2 \n\t&quot;</span>
<a name="l00299"></a>00299             <span class="stringliteral">&quot;clc \n\t&quot;</span>
<a name="l00300"></a>00300             <span class="stringliteral">&quot;rjmp d32u_1%= \n\t&quot;</span>
<a name="l00301"></a>00301             <span class="stringliteral">&quot;d32u_3%=:&quot;</span> <span class="stringliteral">&quot;sec \n\t&quot;</span>
<a name="l00302"></a>00302             <span class="stringliteral">&quot;rjmp d32u_1%= \n\t&quot;</span>
<a name="l00303"></a>00303 
<a name="l00304"></a>00304             <span class="stringliteral">&quot;end%=:&quot;</span> <span class="comment">// end</span>
<a name="l00305"></a>00305             :<span class="stringliteral">&quot;=&amp;r&quot;</span>(a)
<a name="l00306"></a>00306             :<span class="stringliteral">&quot;0&quot;</span>(a),<span class="stringliteral">&quot;r&quot;</span>(b)
<a name="l00307"></a>00307             :<span class="stringliteral">&quot;r14&quot;</span>,<span class="stringliteral">&quot;r15&quot;</span>,<span class="stringliteral">&quot;r16&quot;</span>
<a name="l00308"></a>00308         );
<a name="l00309"></a>00309         <span class="keywordflow">return</span> a;
<a name="l00310"></a>00310 <span class="preprocessor">#else</span>
<a name="l00311"></a>00311 <span class="preprocessor"></span>        <span class="keywordflow">return</span> a/b;
<a name="l00312"></a>00312 <span class="preprocessor">#endif</span>
<a name="l00313"></a>00313 <span class="preprocessor"></span>    }
<a name="l00314"></a><a class="code" href="class_h_a_l.html#af9310c6e80a99ddc7472c50488c0a5de">00314</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="class_h_a_l.html#af9310c6e80a99ddc7472c50488c0a5de">U16SquaredToU32</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> val)
<a name="l00315"></a>00315     {
<a name="l00316"></a>00316         <span class="keywordtype">long</span> res;
<a name="l00317"></a>00317         __asm__ __volatile__ ( <span class="comment">// 15 Ticks</span>
<a name="l00318"></a>00318             <span class="stringliteral">&quot;mul %A1,%A1 \n\t&quot;</span>
<a name="l00319"></a>00319             <span class="stringliteral">&quot;movw %A0,r0 \n\t&quot;</span>
<a name="l00320"></a>00320             <span class="stringliteral">&quot;mul %B1,%B1 \n\t&quot;</span>
<a name="l00321"></a>00321             <span class="stringliteral">&quot;movw %C0,r0 \n\t&quot;</span>
<a name="l00322"></a>00322             <span class="stringliteral">&quot;mul %A1,%B1 \n\t&quot;</span>
<a name="l00323"></a>00323             <span class="stringliteral">&quot;clr %A1 \n\t&quot;</span>
<a name="l00324"></a>00324             <span class="stringliteral">&quot;add %B0,r0 \n\t&quot;</span>
<a name="l00325"></a>00325             <span class="stringliteral">&quot;adc %C0,r1 \n\t&quot;</span>
<a name="l00326"></a>00326             <span class="stringliteral">&quot;adc %D0,%A1 \n\t&quot;</span>
<a name="l00327"></a>00327             <span class="stringliteral">&quot;add %B0,r0 \n\t&quot;</span>
<a name="l00328"></a>00328             <span class="stringliteral">&quot;adc %C0,r1 \n\t&quot;</span>
<a name="l00329"></a>00329             <span class="stringliteral">&quot;adc %D0,%A1 \n\t&quot;</span>
<a name="l00330"></a>00330             <span class="stringliteral">&quot;clr r1 \n\t&quot;</span>
<a name="l00331"></a>00331             : <span class="stringliteral">&quot;=&amp;r&quot;</span>(res),<span class="stringliteral">&quot;=r&quot;</span>(val)
<a name="l00332"></a>00332             : <span class="stringliteral">&quot;1&quot;</span>(val)
<a name="l00333"></a>00333         );
<a name="l00334"></a>00334         <span class="keywordflow">return</span> res;
<a name="l00335"></a>00335     }
<a name="l00336"></a><a class="code" href="class_h_a_l.html#a7a747c87a3bcad76f8e2d9b98ac50e5a">00336</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_h_a_l.html#a7a747c87a3bcad76f8e2d9b98ac50e5a">ComputeV</a>(<span class="keywordtype">long</span> timer,<span class="keywordtype">long</span> accel)
<a name="l00337"></a>00337     {
<a name="l00338"></a>00338 <span class="preprocessor">#if CPU_ARCH==ARCH_AVR</span>
<a name="l00339"></a>00339 <span class="preprocessor"></span>        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> res;
<a name="l00340"></a>00340         <span class="comment">// 38 Ticks</span>
<a name="l00341"></a>00341         __asm__ __volatile__ ( <span class="comment">// 0 = res, 1 = timer, 2 = accel %D2=0 ,%A1 are unused is free</span>
<a name="l00342"></a>00342             <span class="comment">// Result LSB first: %A0, %B0, %A1</span>
<a name="l00343"></a>00343             <span class="stringliteral">&quot;mul %B1,%A2 \n\t&quot;</span>
<a name="l00344"></a>00344             <span class="stringliteral">&quot;mov %A0,r1 \n\t&quot;</span>
<a name="l00345"></a>00345             <span class="stringliteral">&quot;mul %B1,%C2 \n\t&quot;</span>
<a name="l00346"></a>00346             <span class="stringliteral">&quot;mov %B0,r0 \n\t&quot;</span>
<a name="l00347"></a>00347             <span class="stringliteral">&quot;mov %A1,r1 \n\t&quot;</span>
<a name="l00348"></a>00348             <span class="stringliteral">&quot;mul %B1,%B2 \n\t&quot;</span>
<a name="l00349"></a>00349             <span class="stringliteral">&quot;add %A0,r0 \n\t&quot;</span>
<a name="l00350"></a>00350             <span class="stringliteral">&quot;adc %B0,r1 \n\t&quot;</span>
<a name="l00351"></a>00351             <span class="stringliteral">&quot;adc %A1,%D2 \n\t&quot;</span>
<a name="l00352"></a>00352             <span class="stringliteral">&quot;mul %C1,%A2 \n\t&quot;</span>
<a name="l00353"></a>00353             <span class="stringliteral">&quot;add %A0,r0 \n\t&quot;</span>
<a name="l00354"></a>00354             <span class="stringliteral">&quot;adc %B0,r1 \n\t&quot;</span>
<a name="l00355"></a>00355             <span class="stringliteral">&quot;adc %A1,%D2 \n\t&quot;</span>
<a name="l00356"></a>00356             <span class="stringliteral">&quot;mul %C1,%B2 \n\t&quot;</span>
<a name="l00357"></a>00357             <span class="stringliteral">&quot;add %B0,r0 \n\t&quot;</span>
<a name="l00358"></a>00358             <span class="stringliteral">&quot;adc %A1,r1 \n\t&quot;</span>
<a name="l00359"></a>00359             <span class="stringliteral">&quot;mul %D1,%A2 \n\t&quot;</span>
<a name="l00360"></a>00360             <span class="stringliteral">&quot;add %B0,r0 \n\t&quot;</span>
<a name="l00361"></a>00361             <span class="stringliteral">&quot;adc %A1,r1 \n\t&quot;</span>
<a name="l00362"></a>00362             <span class="stringliteral">&quot;mul %C1,%C2 \n\t&quot;</span>
<a name="l00363"></a>00363             <span class="stringliteral">&quot;add %A1,r0 \n\t&quot;</span>
<a name="l00364"></a>00364             <span class="stringliteral">&quot;mul %D1,%B2 \n\t&quot;</span>
<a name="l00365"></a>00365             <span class="stringliteral">&quot;add %A1,r0 \n\t&quot;</span>
<a name="l00366"></a>00366             <span class="stringliteral">&quot;lsr %A1 \n\t&quot;</span>
<a name="l00367"></a>00367             <span class="stringliteral">&quot;ror %B0 \n\t&quot;</span>
<a name="l00368"></a>00368             <span class="stringliteral">&quot;ror %A0 \n\t&quot;</span>
<a name="l00369"></a>00369             <span class="stringliteral">&quot;lsr %A1 \n\t&quot;</span>
<a name="l00370"></a>00370             <span class="stringliteral">&quot;ror %B0 \n\t&quot;</span>
<a name="l00371"></a>00371             <span class="stringliteral">&quot;ror %A0 \n\t&quot;</span>
<a name="l00372"></a>00372             <span class="stringliteral">&quot;clr r1 \n\t&quot;</span>
<a name="l00373"></a>00373             :<span class="stringliteral">&quot;=&amp;r&quot;</span>(res),<span class="stringliteral">&quot;=r&quot;</span>(timer),<span class="stringliteral">&quot;=r&quot;</span>(accel)
<a name="l00374"></a>00374             :<span class="stringliteral">&quot;1&quot;</span>(timer),<span class="stringliteral">&quot;2&quot;</span>(accel)
<a name="l00375"></a>00375             : );
<a name="l00376"></a>00376         <span class="comment">// unsigned int v = ((timer&gt;&gt;8)*cur-&gt;accel)&gt;&gt;10;</span>
<a name="l00377"></a>00377         <span class="keywordflow">return</span> res;
<a name="l00378"></a>00378 <span class="preprocessor">#else</span>
<a name="l00379"></a>00379 <span class="preprocessor"></span>        <span class="keywordflow">return</span> ((timer&gt;&gt;8)*accel)&gt;&gt;10;
<a name="l00380"></a>00380 <span class="preprocessor">#endif</span>
<a name="l00381"></a>00381 <span class="preprocessor"></span>    }
<a name="l00382"></a>00382 <span class="comment">// Multiply two 16 bit values and return 32 bit result</span>
<a name="l00383"></a><a class="code" href="class_h_a_l.html#aed81729e739297a283a88c4313c4d247">00383</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="class_h_a_l.html#aed81729e739297a283a88c4313c4d247">mulu16xu16to32</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> a,<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> b)
<a name="l00384"></a>00384     {
<a name="l00385"></a>00385         <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> res;
<a name="l00386"></a>00386         <span class="comment">// 18 Ticks = 1.125 us</span>
<a name="l00387"></a>00387         __asm__ __volatile__ ( <span class="comment">// 0 = res, 1 = timer, 2 = accel %D2=0 ,%A1 are unused is free</span>
<a name="l00388"></a>00388             <span class="comment">// Result LSB first: %A0, %B0, %A1</span>
<a name="l00389"></a>00389             <span class="stringliteral">&quot;clr r18 \n\t&quot;</span>
<a name="l00390"></a>00390             <span class="stringliteral">&quot;mul %B2,%B1 \n\t&quot;</span> <span class="comment">// mul hig bytes</span>
<a name="l00391"></a>00391             <span class="stringliteral">&quot;movw %C0,r0 \n\t&quot;</span>
<a name="l00392"></a>00392             <span class="stringliteral">&quot;mul %A1,%A2 \n\t&quot;</span> <span class="comment">// mul low bytes</span>
<a name="l00393"></a>00393             <span class="stringliteral">&quot;movw %A0,r0 \n\t&quot;</span>
<a name="l00394"></a>00394             <span class="stringliteral">&quot;mul %A1,%B2 \n\t&quot;</span>
<a name="l00395"></a>00395             <span class="stringliteral">&quot;add %B0,r0 \n\t&quot;</span>
<a name="l00396"></a>00396             <span class="stringliteral">&quot;adc %C0,r1 \n\t&quot;</span>
<a name="l00397"></a>00397             <span class="stringliteral">&quot;adc %D0,r18 \n\t&quot;</span>
<a name="l00398"></a>00398             <span class="stringliteral">&quot;mul %B1,%A2 \n\t&quot;</span>
<a name="l00399"></a>00399             <span class="stringliteral">&quot;add %B0,r0 \n\t&quot;</span>
<a name="l00400"></a>00400             <span class="stringliteral">&quot;adc %C0,r1 \n\t&quot;</span>
<a name="l00401"></a>00401             <span class="stringliteral">&quot;adc %D0,r18 \n\t&quot;</span>
<a name="l00402"></a>00402             <span class="stringliteral">&quot;clr r1 \n\t&quot;</span>
<a name="l00403"></a>00403             :<span class="stringliteral">&quot;=&amp;r&quot;</span>(res),<span class="stringliteral">&quot;=r&quot;</span>(a),<span class="stringliteral">&quot;=r&quot;</span>(b)
<a name="l00404"></a>00404             :<span class="stringliteral">&quot;1&quot;</span>(a),<span class="stringliteral">&quot;2&quot;</span>(b)
<a name="l00405"></a>00405             :<span class="stringliteral">&quot;r18&quot;</span> );
<a name="l00406"></a>00406         <span class="comment">// return (long)a*b;</span>
<a name="l00407"></a>00407         <span class="keywordflow">return</span> res;
<a name="l00408"></a>00408     }
<a name="l00409"></a>00409 <span class="comment">// Multiply two 16 bit values and return 32 bit result</span>
<a name="l00410"></a><a class="code" href="class_h_a_l.html#a5865166dfdd8a9ff9bd57f7d0c970856">00410</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_h_a_l.html#a5865166dfdd8a9ff9bd57f7d0c970856">mulu6xu16shift16</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> a,<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> b)
<a name="l00411"></a>00411     {
<a name="l00412"></a>00412 <span class="preprocessor">#if CPU_ARCH==ARCH_AVR</span>
<a name="l00413"></a>00413 <span class="preprocessor"></span>        <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> res;
<a name="l00414"></a>00414         <span class="comment">// 18 Ticks = 1.125 us</span>
<a name="l00415"></a>00415         __asm__ __volatile__ ( <span class="comment">// 0 = res, 1 = timer, 2 = accel %D2=0 ,%A1 are unused is free</span>
<a name="l00416"></a>00416             <span class="comment">// Result LSB first: %A0, %B0, %A1</span>
<a name="l00417"></a>00417             <span class="stringliteral">&quot;clr r18 \n\t&quot;</span>
<a name="l00418"></a>00418             <span class="stringliteral">&quot;mul %B2,%B1 \n\t&quot;</span> <span class="comment">// mul hig bytes</span>
<a name="l00419"></a>00419             <span class="stringliteral">&quot;movw %A0,r0 \n\t&quot;</span>
<a name="l00420"></a>00420             <span class="stringliteral">&quot;mul %A1,%A2 \n\t&quot;</span> <span class="comment">// mul low bytes</span>
<a name="l00421"></a>00421             <span class="stringliteral">&quot;mov r19,r1 \n\t&quot;</span>
<a name="l00422"></a>00422             <span class="stringliteral">&quot;mul %A1,%B2 \n\t&quot;</span>
<a name="l00423"></a>00423             <span class="stringliteral">&quot;add r19,r0 \n\t&quot;</span>
<a name="l00424"></a>00424             <span class="stringliteral">&quot;adc %A0,r1 \n\t&quot;</span>
<a name="l00425"></a>00425             <span class="stringliteral">&quot;adc %B0,r18 \n\t&quot;</span>
<a name="l00426"></a>00426             <span class="stringliteral">&quot;mul %B1,%A2 \n\t&quot;</span>
<a name="l00427"></a>00427             <span class="stringliteral">&quot;add r19,r0 \n\t&quot;</span>
<a name="l00428"></a>00428             <span class="stringliteral">&quot;adc %A0,r1 \n\t&quot;</span>
<a name="l00429"></a>00429             <span class="stringliteral">&quot;adc %B0,r18 \n\t&quot;</span>
<a name="l00430"></a>00430             <span class="stringliteral">&quot;clr r1 \n\t&quot;</span>
<a name="l00431"></a>00431             :<span class="stringliteral">&quot;=&amp;r&quot;</span>(res),<span class="stringliteral">&quot;=r&quot;</span>(a),<span class="stringliteral">&quot;=r&quot;</span>(b)
<a name="l00432"></a>00432             :<span class="stringliteral">&quot;1&quot;</span>(a),<span class="stringliteral">&quot;2&quot;</span>(b)
<a name="l00433"></a>00433             :<span class="stringliteral">&quot;r18&quot;</span>,<span class="stringliteral">&quot;r19&quot;</span> );
<a name="l00434"></a>00434         <span class="keywordflow">return</span> res;
<a name="l00435"></a>00435 <span class="preprocessor">#else</span>
<a name="l00436"></a>00436 <span class="preprocessor"></span>        <span class="keywordflow">return</span> ((<span class="keywordtype">long</span>)a*b)&gt;&gt;16;
<a name="l00437"></a>00437 <span class="preprocessor">#endif</span>
<a name="l00438"></a>00438 <span class="preprocessor"></span>    }
<a name="l00439"></a><a class="code" href="class_h_a_l.html#a96674ad510b66c51e3b2ba191e403f4d">00439</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a96674ad510b66c51e3b2ba191e403f4d">digitalWrite</a>(uint8_t pin,uint8_t value)
<a name="l00440"></a>00440     {
<a name="l00441"></a>00441         <a class="code" href="class_h_a_l.html#a96674ad510b66c51e3b2ba191e403f4d">::digitalWrite</a>(pin,value);
<a name="l00442"></a>00442     }
<a name="l00443"></a><a class="code" href="class_h_a_l.html#a3f9e2d2c30df9ba03affa325d5a0eb53">00443</a>     <span class="keyword">static</span> <span class="keyword">inline</span> uint8_t <a class="code" href="class_h_a_l.html#a3f9e2d2c30df9ba03affa325d5a0eb53">digitalRead</a>(uint8_t pin)
<a name="l00444"></a>00444     {
<a name="l00445"></a>00445         <a class="code" href="class_h_a_l.html#a3f9e2d2c30df9ba03affa325d5a0eb53">return ::digitalRead</a>(pin);
<a name="l00446"></a>00446     }
<a name="l00447"></a><a class="code" href="class_h_a_l.html#a5643915ee545161f9710d4bb015c0969">00447</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a5643915ee545161f9710d4bb015c0969">pinMode</a>(uint8_t pin,uint8_t mode)
<a name="l00448"></a>00448     {
<a name="l00449"></a>00449         <a class="code" href="class_h_a_l.html#a5643915ee545161f9710d4bb015c0969">::pinMode</a>(pin,mode);
<a name="l00450"></a>00450     }
<a name="l00451"></a>00451     <span class="keyword">static</span> <span class="keywordtype">long</span> <a class="code" href="class_h_a_l.html#a7e111cca1359d85efb144985c3a83dbd" title="approximates division of F_CPU/divisor">CPUDivU2</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> divisor);
<a name="l00452"></a><a class="code" href="class_h_a_l.html#a9c21525c92e4753a86201165ba0f9550">00452</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a9c21525c92e4753a86201165ba0f9550">delayMicroseconds</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> delayUs)
<a name="l00453"></a>00453     {
<a name="l00454"></a>00454         <a class="code" href="class_h_a_l.html#a9c21525c92e4753a86201165ba0f9550">::delayMicroseconds</a>(delayUs);
<a name="l00455"></a>00455     }
<a name="l00456"></a><a class="code" href="class_h_a_l.html#aa1769a083cbec3c5314c4d6da22f6d8b">00456</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#aa1769a083cbec3c5314c4d6da22f6d8b">delayMilliseconds</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> delayMs)
<a name="l00457"></a>00457     {
<a name="l00458"></a>00458         ::delay(delayMs);
<a name="l00459"></a>00459     }
<a name="l00460"></a><a class="code" href="class_h_a_l.html#a7b0c899559312f1df735ac44eb5dd33d">00460</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a7b0c899559312f1df735ac44eb5dd33d">tone</a>(uint8_t pin,<span class="keywordtype">int</span> duration)
<a name="l00461"></a>00461     {
<a name="l00462"></a>00462         <a class="code" href="class_h_a_l.html#a7b0c899559312f1df735ac44eb5dd33d">::tone</a>(pin,duration);
<a name="l00463"></a>00463     }
<a name="l00464"></a><a class="code" href="class_h_a_l.html#a2d1a46489e979b07587535e1723e0009">00464</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a2d1a46489e979b07587535e1723e0009">noTone</a>(uint8_t pin)
<a name="l00465"></a>00465     {
<a name="l00466"></a>00466         <a class="code" href="class_h_a_l.html#a2d1a46489e979b07587535e1723e0009">::noTone</a>(pin);
<a name="l00467"></a>00467     }
<a name="l00468"></a><a class="code" href="class_h_a_l.html#a8f4e462098ac1eef804e8e45addff4e6">00468</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a8f4e462098ac1eef804e8e45addff4e6">eprSetByte</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pos,uint8_t value)
<a name="l00469"></a>00469     {
<a name="l00470"></a>00470         eeprom_write_byte((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *)(<a class="code" href="_h_a_l_8h.html#afe7387252655a7ee07b26cb83c5ed0be">EEPROM_OFFSET</a>+pos), value);
<a name="l00471"></a>00471     }
<a name="l00472"></a><a class="code" href="class_h_a_l.html#a5972e15871bb7d4ea4636d6c167759b2">00472</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a5972e15871bb7d4ea4636d6c167759b2">eprSetInt16</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pos,int16_t value)
<a name="l00473"></a>00473     {
<a name="l00474"></a>00474         eeprom_write_word((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>*)(<a class="code" href="_h_a_l_8h.html#afe7387252655a7ee07b26cb83c5ed0be">EEPROM_OFFSET</a>+pos),value);
<a name="l00475"></a>00475     }
<a name="l00476"></a><a class="code" href="class_h_a_l.html#a17fc7028929dd07596c3f3547292ad88">00476</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a17fc7028929dd07596c3f3547292ad88">eprSetInt32</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pos,int32_t value)
<a name="l00477"></a>00477     {
<a name="l00478"></a>00478         eeprom_write_dword((uint32_t*)(<a class="code" href="_h_a_l_8h.html#afe7387252655a7ee07b26cb83c5ed0be">EEPROM_OFFSET</a>+pos),value);
<a name="l00479"></a>00479     }
<a name="l00480"></a><a class="code" href="class_h_a_l.html#a2e5b4ff462e9319ce841732d306c7bda">00480</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a2e5b4ff462e9319ce841732d306c7bda">eprSetFloat</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pos,<span class="keywordtype">float</span> value)
<a name="l00481"></a>00481     {
<a name="l00482"></a>00482         eeprom_write_block(&amp;value,(<span class="keywordtype">void</span>*)(<a class="code" href="_h_a_l_8h.html#afe7387252655a7ee07b26cb83c5ed0be">EEPROM_OFFSET</a>+pos), 4);
<a name="l00483"></a>00483     }
<a name="l00484"></a><a class="code" href="class_h_a_l.html#abf59c48dfd636724c15100ef1866899d">00484</a>     <span class="keyword">static</span> <span class="keyword">inline</span> uint8_t <a class="code" href="class_h_a_l.html#abf59c48dfd636724c15100ef1866899d">eprGetByte</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pos)
<a name="l00485"></a>00485     {
<a name="l00486"></a>00486         <span class="keywordflow">return</span> eeprom_read_byte ((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *)(<a class="code" href="_h_a_l_8h.html#afe7387252655a7ee07b26cb83c5ed0be">EEPROM_OFFSET</a>+pos));
<a name="l00487"></a>00487     }
<a name="l00488"></a><a class="code" href="class_h_a_l.html#ab06e7809bbb8ba7845390d77646ce3c2">00488</a>     <span class="keyword">static</span> <span class="keyword">inline</span> int16_t <a class="code" href="class_h_a_l.html#ab06e7809bbb8ba7845390d77646ce3c2">eprGetInt16</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pos)
<a name="l00489"></a>00489     {
<a name="l00490"></a>00490         <span class="keywordflow">return</span> eeprom_read_word((uint16_t *)(<a class="code" href="_h_a_l_8h.html#afe7387252655a7ee07b26cb83c5ed0be">EEPROM_OFFSET</a>+pos));
<a name="l00491"></a>00491     }
<a name="l00492"></a><a class="code" href="class_h_a_l.html#afbffb37148267a3d4caf95ff616e8657">00492</a>     <span class="keyword">static</span> <span class="keyword">inline</span> int32_t <a class="code" href="class_h_a_l.html#afbffb37148267a3d4caf95ff616e8657">eprGetInt32</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pos)
<a name="l00493"></a>00493     {
<a name="l00494"></a>00494         <span class="keywordflow">return</span> eeprom_read_dword((uint32_t*)(<a class="code" href="_h_a_l_8h.html#afe7387252655a7ee07b26cb83c5ed0be">EEPROM_OFFSET</a>+pos));
<a name="l00495"></a>00495     }
<a name="l00496"></a><a class="code" href="class_h_a_l.html#a9d4b0a749807ef9f8f9816f3e60c4d94">00496</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">float</span> <a class="code" href="class_h_a_l.html#a9d4b0a749807ef9f8f9816f3e60c4d94">eprGetFloat</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pos)
<a name="l00497"></a>00497     {
<a name="l00498"></a>00498         <span class="keywordtype">float</span> v;
<a name="l00499"></a>00499         eeprom_read_block(&amp;v,(<span class="keywordtype">void</span> *)(<a class="code" href="_h_a_l_8h.html#afe7387252655a7ee07b26cb83c5ed0be">EEPROM_OFFSET</a>+pos),4); <span class="comment">// newer gcc have eeprom_read_block but not arduino 22</span>
<a name="l00500"></a>00500         <span class="keywordflow">return</span> v;
<a name="l00501"></a>00501     }
<a name="l00502"></a><a class="code" href="class_h_a_l.html#af342bda39004b757cd9656dd9deb90df">00502</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#af342bda39004b757cd9656dd9deb90df">allowInterrupts</a>()
<a name="l00503"></a>00503     {
<a name="l00504"></a>00504         sei();
<a name="l00505"></a>00505     }
<a name="l00506"></a><a class="code" href="class_h_a_l.html#a9d22df0fcf68ff5b98b830b2292515e7">00506</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a9d22df0fcf68ff5b98b830b2292515e7">forbidInterrupts</a>()
<a name="l00507"></a>00507     {
<a name="l00508"></a>00508         cli();
<a name="l00509"></a>00509     }
<a name="l00510"></a><a class="code" href="class_h_a_l.html#a65d1c288f4c20829327fa833a237b88e">00510</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="class_h_a_l.html#a65d1c288f4c20829327fa833a237b88e">timeInMilliseconds</a>()
<a name="l00511"></a>00511     {
<a name="l00512"></a>00512         <span class="keywordflow">return</span> millis();
<a name="l00513"></a>00513     }
<a name="l00514"></a><a class="code" href="class_h_a_l.html#aa58a2c274b4886400875720562c4ee5d">00514</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">char</span> <a class="code" href="class_h_a_l.html#aa58a2c274b4886400875720562c4ee5d">readFlashByte</a>(PGM_P ptr)
<a name="l00515"></a>00515     {
<a name="l00516"></a>00516         <span class="keywordflow">return</span> pgm_read_byte(ptr);
<a name="l00517"></a>00517     }
<a name="l00518"></a><a class="code" href="class_h_a_l.html#a0046551b22d5f512dde823eed4044a21">00518</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a0046551b22d5f512dde823eed4044a21">serialSetBaudrate</a>(<span class="keywordtype">long</span> baud)
<a name="l00519"></a>00519     {
<a name="l00520"></a>00520         <a class="code" href="_h_a_l_8h.html#a17da3e86d60c2b299dd9e523bf746699">RFSERIAL</a>.begin(baud);
<a name="l00521"></a>00521     }
<a name="l00522"></a><a class="code" href="class_h_a_l.html#ab2c1a65532132814998831a3d9efe622">00522</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="class_h_a_l.html#ab2c1a65532132814998831a3d9efe622">serialByteAvailable</a>()
<a name="l00523"></a>00523     {
<a name="l00524"></a>00524         <span class="keywordflow">return</span> <a class="code" href="_h_a_l_8h.html#a17da3e86d60c2b299dd9e523bf746699">RFSERIAL</a>.available()&gt;0;
<a name="l00525"></a>00525     }
<a name="l00526"></a><a class="code" href="class_h_a_l.html#af70d2dbfc1a9b6a941abbe369b6b6f3d">00526</a>     <span class="keyword">static</span> <span class="keyword">inline</span> uint8_t <a class="code" href="class_h_a_l.html#af70d2dbfc1a9b6a941abbe369b6b6f3d">serialReadByte</a>()
<a name="l00527"></a>00527     {
<a name="l00528"></a>00528         <span class="keywordflow">return</span> <a class="code" href="_h_a_l_8h.html#a17da3e86d60c2b299dd9e523bf746699">RFSERIAL</a>.read();
<a name="l00529"></a>00529     }
<a name="l00530"></a><a class="code" href="class_h_a_l.html#af1aeb3ec8ae32252dc8ed3d90197fdef">00530</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#af1aeb3ec8ae32252dc8ed3d90197fdef">serialWriteByte</a>(<span class="keywordtype">char</span> b)
<a name="l00531"></a>00531     {
<a name="l00532"></a>00532         <a class="code" href="_h_a_l_8h.html#a17da3e86d60c2b299dd9e523bf746699">RFSERIAL</a>.write(b);
<a name="l00533"></a>00533     }
<a name="l00534"></a><a class="code" href="class_h_a_l.html#a2d8733842c2e2df337be87b466f16de1">00534</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a2d8733842c2e2df337be87b466f16de1">serialFlush</a>()
<a name="l00535"></a>00535     {
<a name="l00536"></a>00536         <a class="code" href="_h_a_l_8h.html#a17da3e86d60c2b299dd9e523bf746699">RFSERIAL</a>.flush();
<a name="l00537"></a>00537     }
<a name="l00538"></a>00538     <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a9745f35ca229658cc342286ea75c0b77">setupTimer</a>();
<a name="l00539"></a>00539     <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a4b4b830e978ba8c24df1ea68071e481e">showStartReason</a>();
<a name="l00540"></a>00540     <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_h_a_l.html#a45aca2c95be04bccafb958e08a3bcf1a">getFreeRam</a>();
<a name="l00541"></a>00541     <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#aa602b512765a5e33965856fc4e8d7dff">resetHardware</a>();
<a name="l00542"></a>00542 
<a name="l00543"></a>00543     <span class="comment">// SPI related functions</span>
<a name="l00544"></a><a class="code" href="class_h_a_l.html#afbbde126ab31dc77a85657f4a6b3dcdd">00544</a>     <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#afbbde126ab31dc77a85657f4a6b3dcdd">spiBegin</a>()
<a name="l00545"></a>00545     {
<a name="l00546"></a>00546         <a class="code" href="fastio_8h.html#afa76df25ccdb2d113a057c8c305399cc" title="set pin as input wrapper">SET_INPUT</a>(MISO_PIN);
<a name="l00547"></a>00547         <a class="code" href="fastio_8h.html#a4bdb8759f0e85e88956ac23262e0916b" title="set pin as output wrapper">SET_OUTPUT</a>(MOSI_PIN);
<a name="l00548"></a>00548         <a class="code" href="fastio_8h.html#a4bdb8759f0e85e88956ac23262e0916b" title="set pin as output wrapper">SET_OUTPUT</a>(SCK_PIN);
<a name="l00549"></a>00549         <span class="comment">// SS must be in output mode even it is not chip select</span>
<a name="l00550"></a>00550         <a class="code" href="fastio_8h.html#a4bdb8759f0e85e88956ac23262e0916b" title="set pin as output wrapper">SET_OUTPUT</a>(<a class="code" href="pins_8h.html#ace91a4e928d61240785c9438be8651d0">SDSS</a>);
<a name="l00551"></a>00551 <span class="preprocessor">#if SDSSORIG &gt;- 1</span>
<a name="l00552"></a>00552 <span class="preprocessor"></span>        <a class="code" href="fastio_8h.html#a4bdb8759f0e85e88956ac23262e0916b" title="set pin as output wrapper">SET_OUTPUT</a>(SDSSORIG);
<a name="l00553"></a>00553 <span class="preprocessor">#endif</span>
<a name="l00554"></a>00554 <span class="preprocessor"></span>        <span class="comment">// set SS high - may be chip select for another SPI device</span>
<a name="l00555"></a>00555 <span class="preprocessor">#if SET_SPI_SS_HIGH</span>
<a name="l00556"></a>00556 <span class="preprocessor"></span>        <a class="code" href="fastio_8h.html#a3d38c0667426652d3fa2eb62f23e1591" title="Write to a pin wrapper.">WRITE</a>(<a class="code" href="pins_8h.html#ace91a4e928d61240785c9438be8651d0">SDSS</a>, HIGH);
<a name="l00557"></a>00557 <span class="preprocessor">#endif  // SET_SPI_SS_HIGH</span>
<a name="l00558"></a>00558 <span class="preprocessor"></span>    }
<a name="l00559"></a><a class="code" href="class_h_a_l.html#ab0d9589c111450f0729af0020b7d41b3">00559</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#ab0d9589c111450f0729af0020b7d41b3">spiInit</a>(uint8_t spiRate)
<a name="l00560"></a>00560     {
<a name="l00561"></a>00561         spiRate = spiRate &gt; 12 ? 6 : spiRate/2;
<a name="l00562"></a>00562         <a class="code" href="fastio_8h.html#a4bdb8759f0e85e88956ac23262e0916b" title="set pin as output wrapper">SET_OUTPUT</a>(SS);
<a name="l00563"></a>00563         <a class="code" href="fastio_8h.html#a3d38c0667426652d3fa2eb62f23e1591" title="Write to a pin wrapper.">WRITE</a>(SS,HIGH);
<a name="l00564"></a>00564         <a class="code" href="fastio_8h.html#a4bdb8759f0e85e88956ac23262e0916b" title="set pin as output wrapper">SET_OUTPUT</a>(SCK);
<a name="l00565"></a>00565         <a class="code" href="fastio_8h.html#a4bdb8759f0e85e88956ac23262e0916b" title="set pin as output wrapper">SET_OUTPUT</a>(MOSI_PIN);
<a name="l00566"></a>00566         <a class="code" href="fastio_8h.html#afa76df25ccdb2d113a057c8c305399cc" title="set pin as input wrapper">SET_INPUT</a>(MISO_PIN);
<a name="l00567"></a>00567 <span class="preprocessor">#ifdef  PRR</span>
<a name="l00568"></a>00568 <span class="preprocessor"></span>        PRR &amp;= ~(1&lt;&lt;PRSPI);
<a name="l00569"></a>00569 <span class="preprocessor">#elif defined PRR0</span>
<a name="l00570"></a>00570 <span class="preprocessor"></span>        PRR0 &amp;= ~(1&lt;&lt;PRSPI);
<a name="l00571"></a>00571 <span class="preprocessor">#endif</span>
<a name="l00572"></a>00572 <span class="preprocessor"></span>        <span class="comment">// See avr processor documentation</span>
<a name="l00573"></a>00573         SPCR = (1 &lt;&lt; SPE) | (1 &lt;&lt; MSTR) | (spiRate &gt;&gt; 1);
<a name="l00574"></a>00574         SPSR = spiRate &amp; 1 || spiRate == 6 ? 0 : 1 &lt;&lt; SPI2X;
<a name="l00575"></a>00575 
<a name="l00576"></a>00576     }
<a name="l00577"></a><a class="code" href="class_h_a_l.html#a9cb19ad0ebcea3a90cccea4f9cb34517">00577</a>     <span class="keyword">static</span> <span class="keyword">inline</span> uint8_t <a class="code" href="class_h_a_l.html#a9cb19ad0ebcea3a90cccea4f9cb34517">spiReceive</a>(uint8_t send=0xff)
<a name="l00578"></a>00578     {
<a name="l00579"></a>00579         SPDR = send;
<a name="l00580"></a>00580         <span class="keywordflow">while</span> (!(SPSR &amp; (1 &lt;&lt; SPIF)));
<a name="l00581"></a>00581         <span class="keywordflow">return</span> SPDR;
<a name="l00582"></a>00582     }
<a name="l00583"></a><a class="code" href="class_h_a_l.html#ad8bdf682128340583807cf04541a3e07">00583</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#ad8bdf682128340583807cf04541a3e07">spiReadBlock</a>(uint8_t*buf,<span class="keywordtype">size_t</span> nbyte)
<a name="l00584"></a>00584     {
<a name="l00585"></a>00585         <span class="keywordflow">if</span> (nbyte-- == 0) <span class="keywordflow">return</span>;
<a name="l00586"></a>00586         SPDR = 0XFF;
<a name="l00587"></a>00587         <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; nbyte; i++)
<a name="l00588"></a>00588         {
<a name="l00589"></a>00589             <span class="keywordflow">while</span> (!(SPSR &amp; (1 &lt;&lt; SPIF)));
<a name="l00590"></a>00590             buf[i] = SPDR;
<a name="l00591"></a>00591             SPDR = 0XFF;
<a name="l00592"></a>00592         }
<a name="l00593"></a>00593         <span class="keywordflow">while</span> (!(SPSR &amp; (1 &lt;&lt; SPIF)));
<a name="l00594"></a>00594         buf[nbyte] = SPDR;
<a name="l00595"></a>00595     }
<a name="l00596"></a><a class="code" href="class_h_a_l.html#a19e8440b98633609d5fca69e6201ec99">00596</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a19e8440b98633609d5fca69e6201ec99">spiSend</a>(uint8_t b)
<a name="l00597"></a>00597     {
<a name="l00598"></a>00598         SPDR = b;
<a name="l00599"></a>00599         <span class="keywordflow">while</span> (!(SPSR &amp; (1 &lt;&lt; SPIF)));
<a name="l00600"></a>00600     }
<a name="l00601"></a><a class="code" href="class_h_a_l.html#a63037c75b9adfbc5a681f30e39a65bf5">00601</a>     <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a19e8440b98633609d5fca69e6201ec99">spiSend</a>(<span class="keyword">const</span> uint8_t* buf , <span class="keywordtype">size_t</span> n)
<a name="l00602"></a>00602     {
<a name="l00603"></a>00603         <span class="keywordflow">if</span> (n == 0) <span class="keywordflow">return</span>;
<a name="l00604"></a>00604         SPDR = buf[0];
<a name="l00605"></a>00605         <span class="keywordflow">if</span> (n &gt; 1)
<a name="l00606"></a>00606         {
<a name="l00607"></a>00607             uint8_t b = buf[1];
<a name="l00608"></a>00608             <span class="keywordtype">size_t</span> i = 2;
<a name="l00609"></a>00609             <span class="keywordflow">while</span> (1)
<a name="l00610"></a>00610             {
<a name="l00611"></a>00611                 <span class="keywordflow">while</span> (!(SPSR &amp; (1 &lt;&lt; SPIF)));
<a name="l00612"></a>00612                 SPDR = b;
<a name="l00613"></a>00613                 <span class="keywordflow">if</span> (i == n) <span class="keywordflow">break</span>;
<a name="l00614"></a>00614                 b = buf[i++];
<a name="l00615"></a>00615             }
<a name="l00616"></a>00616         }
<a name="l00617"></a>00617         <span class="keywordflow">while</span> (!(SPSR &amp; (1 &lt;&lt; SPIF)));
<a name="l00618"></a>00618     }
<a name="l00619"></a>00619 
<a name="l00620"></a>00620     <span class="keyword">static</span> <span class="keyword">inline</span> <a class="code" href="class_h_a_l.html#adce538c95a5f53cd6a95f28f2c6d18ec">__attribute__</a>((always_inline))
<a name="l00621"></a>00621     void spiSendBlock(uint8_t token, const uint8_t* buf)
<a name="l00622"></a>00622     {
<a name="l00623"></a>00623         SPDR = token;
<a name="l00624"></a>00624         <span class="keywordflow">for</span> (uint16_t i = 0; i &lt; 512; i += 2)
<a name="l00625"></a>00625         {
<a name="l00626"></a>00626             <span class="keywordflow">while</span> (!(SPSR &amp; (1 &lt;&lt; SPIF)));
<a name="l00627"></a>00627             SPDR = buf[i];
<a name="l00628"></a>00628             <span class="keywordflow">while</span> (!(SPSR &amp; (1 &lt;&lt; SPIF)));
<a name="l00629"></a>00629             SPDR = buf[i + 1];
<a name="l00630"></a>00630         }
<a name="l00631"></a>00631         <span class="keywordflow">while</span> (!(SPSR &amp; (1 &lt;&lt; SPIF)));
<a name="l00632"></a>00632     }
<a name="l00633"></a>00633 
<a name="l00634"></a>00634     <span class="comment">// I2C Support</span>
<a name="l00635"></a>00635 
<a name="l00636"></a>00636     <span class="keyword">static</span> <span class="keywordtype">void</span> i2cInit(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> clockSpeedHz);
<a name="l00637"></a>00637     <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="class_h_a_l.html#a12b0aae6b2d3f48ac6a011b27fb2f653">i2cStart</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> address);
<a name="l00638"></a>00638     <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a80acad3cb511fbc8b546c64eccb40c20">i2cStartWait</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> address);
<a name="l00639"></a>00639     <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a46f365de216a017131a0fdc53067b741">i2cStop</a>(<span class="keywordtype">void</span>);
<a name="l00640"></a>00640     <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="class_h_a_l.html#a2b905c212d29a99cd82e7f16d8572ed0">i2cWrite</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> data );
<a name="l00641"></a>00641     <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="class_h_a_l.html#ab7b23a8495801a3ec28f2b2e3e483df1">i2cReadAck</a>(<span class="keywordtype">void</span>);
<a name="l00642"></a>00642     <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="class_h_a_l.html#aee78ce54d9b9923624e960f77669852e">i2cReadNak</a>(<span class="keywordtype">void</span>);
<a name="l00643"></a>00643 
<a name="l00644"></a>00644     <span class="comment">// Watchdog support</span>
<a name="l00645"></a>00645 
<a name="l00646"></a><a class="code" href="class_h_a_l.html#ab15f188de861307c769276cc16d1d740">00646</a>     <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#ab15f188de861307c769276cc16d1d740">startWatchdog</a>()
<a name="l00647"></a>00647     {
<a name="l00648"></a>00648         wdt_enable(WDTO_1S);
<a name="l00649"></a>00649     };
<a name="l00650"></a><a class="code" href="class_h_a_l.html#ae7ea055851e887aaa3037c3dc6e5377d">00650</a>     <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#ae7ea055851e887aaa3037c3dc6e5377d">stopWatchdog</a>()
<a name="l00651"></a>00651     {
<a name="l00652"></a>00652         wdt_disable();
<a name="l00653"></a>00653     }
<a name="l00654"></a><a class="code" href="class_h_a_l.html#a0b8960a0664509defcc1e2a6901c5020">00654</a>     <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a0b8960a0664509defcc1e2a6901c5020">pingWatchdog</a>()
<a name="l00655"></a>00655     {
<a name="l00656"></a>00656         wdt_reset();
<a name="l00657"></a>00657     };
<a name="l00658"></a><a class="code" href="class_h_a_l.html#a901a30c03317102d602c281c675f9173">00658</a>     <span class="keyword">inline</span> <span class="keyword">static</span> <span class="keywordtype">float</span> <a class="code" href="class_h_a_l.html#a901a30c03317102d602c281c675f9173">maxExtruderTimerFrequency</a>()
<a name="l00659"></a>00659     {
<a name="l00660"></a>00660         <span class="keywordflow">return</span> (<span class="keywordtype">float</span>)F_CPU/<a class="code" href="_h_a_l_8h.html#a806ea970ccbc3c57a4d4ad45dbbb4725" title="Prescale factor, timer0 runs at.">TIMER0_PRESCALE</a>;
<a name="l00661"></a>00661     }
<a name="l00662"></a>00662 <span class="preprocessor">#if FEATURE_SERVO</span>
<a name="l00663"></a>00663 <span class="preprocessor"></span>    <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> servoTimings[4];
<a name="l00664"></a>00664     <span class="keyword">static</span> <span class="keywordtype">void</span> servoMicroseconds(uint8_t servo,<span class="keywordtype">int</span> ms);
<a name="l00665"></a>00665 <span class="preprocessor">#endif</span>
<a name="l00666"></a>00666 <span class="preprocessor"></span>    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_h_a_l.html#a84836ee79baf56573a74cb69663faabf">analogStart</a>();
<a name="l00667"></a>00667 <span class="keyword">protected</span>:
<a name="l00668"></a>00668 <span class="keyword">private</span>:
<a name="l00669"></a>00669 };
<a name="l00670"></a>00670 <span class="comment">/*#if MOTHERBOARD==6 || MOTHERBOARD==62 || MOTHERBOARD==7</span>
<a name="l00671"></a>00671 <span class="comment">#if MOTHERBOARD!=7</span>
<a name="l00672"></a>00672 <span class="comment">#define SIMULATE_PWM</span>
<a name="l00673"></a>00673 <span class="comment">#endif</span>
<a name="l00674"></a>00674 <span class="comment">#define EXTRUDER_TIMER_VECTOR TIMER2_COMPA_vect</span>
<a name="l00675"></a>00675 <span class="comment">#define EXTRUDER_OCR OCR2A</span>
<a name="l00676"></a>00676 <span class="comment">#define EXTRUDER_TCCR TCCR2A</span>
<a name="l00677"></a>00677 <span class="comment">#define EXTRUDER_TIMSK TIMSK2</span>
<a name="l00678"></a>00678 <span class="comment">#define EXTRUDER_OCIE OCIE2A</span>
<a name="l00679"></a>00679 <span class="comment">#define PWM_TIMER_VECTOR TIMER2_COMPB_vect</span>
<a name="l00680"></a>00680 <span class="comment">#define PWM_OCR OCR2B</span>
<a name="l00681"></a>00681 <span class="comment">#define PWM_TCCR TCCR2B</span>
<a name="l00682"></a>00682 <span class="comment">#define PWM_TIMSK TIMSK2</span>
<a name="l00683"></a>00683 <span class="comment">#define PWM_OCIE OCIE2B</span>
<a name="l00684"></a>00684 <span class="comment">#else*/</span>
<a name="l00685"></a><a class="code" href="_h_a_l_8h.html#a5493104832094f07b22a464e74bd27e5">00685</a> <span class="preprocessor">#define EXTRUDER_TIMER_VECTOR TIMER0_COMPA_vect</span>
<a name="l00686"></a><a class="code" href="_h_a_l_8h.html#ab2ee6e3d51e61ad0bb6b3cad752d370f">00686</a> <span class="preprocessor"></span><span class="preprocessor">#define EXTRUDER_OCR OCR0A</span>
<a name="l00687"></a><a class="code" href="_h_a_l_8h.html#ac42ca5d0c9feeea62388c90bdbefb07e">00687</a> <span class="preprocessor"></span><span class="preprocessor">#define EXTRUDER_TCCR TCCR0A</span>
<a name="l00688"></a><a class="code" href="_h_a_l_8h.html#a79f67c6e1d741eaa6031589fe1d5541c">00688</a> <span class="preprocessor"></span><span class="preprocessor">#define EXTRUDER_TIMSK TIMSK0</span>
<a name="l00689"></a><a class="code" href="_h_a_l_8h.html#aba2d8b413b09fbcd79663a684e0f2a37">00689</a> <span class="preprocessor"></span><span class="preprocessor">#define EXTRUDER_OCIE OCIE0A</span>
<a name="l00690"></a><a class="code" href="_h_a_l_8h.html#a0ad5f01af339a57de4bd2a3531300d18">00690</a> <span class="preprocessor"></span><span class="preprocessor">#define PWM_TIMER_VECTOR TIMER0_COMPB_vect</span>
<a name="l00691"></a><a class="code" href="_h_a_l_8h.html#a52bf5f75ac47d9f19ac0b732aaccbefa">00691</a> <span class="preprocessor"></span><span class="preprocessor">#define PWM_OCR OCR0B</span>
<a name="l00692"></a><a class="code" href="_h_a_l_8h.html#a6942ce3f11c17a2e79db0615f8c590ac">00692</a> <span class="preprocessor"></span><span class="preprocessor">#define PWM_TCCR TCCR0A</span>
<a name="l00693"></a><a class="code" href="_h_a_l_8h.html#a5b1f41fba5eb7c7b9f73803341f1b864">00693</a> <span class="preprocessor"></span><span class="preprocessor">#define PWM_TIMSK TIMSK0</span>
<a name="l00694"></a><a class="code" href="_h_a_l_8h.html#a25524bb70fb55ea5dd84979ad623e078">00694</a> <span class="preprocessor"></span><span class="preprocessor">#define PWM_OCIE OCIE0B</span>
<a name="l00695"></a>00695 <span class="preprocessor"></span><span class="comment">//#endif</span>
<a name="l00696"></a>00696 <span class="preprocessor">#endif // HAL_H</span>
</pre></div></div><!-- contents -->
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="_h_a_l_8h.html">HAL.h</a>      </li>

    <li class="footer">Generated on Mon Dec 30 2013 18:53:02 for Repetier-Firmware by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
